import {Http} from "../utils/http"
import {User} from "./user"

export function GetTravels(data) {
    return Http.request({
        url: '/travels',
        data,
        method: 'GET'
    })
}
export function GetUserTravels(data) {
    const user = new User()
    return Http.request({
        url: `/users/${user.user.id}/travels_stat`,
        data,
        method: 'GET'
    })
}
export function GetTravelDetail(id) {
    return Http.request({
        url: `/travels/${id}`,
        method: 'GET'
    })
}
export function GetUserTravelsDetail(data) {
    const user = new User()
    return Http.request({
        url: `/users/${user.user.id}/travels`,
        data,
        method: 'GET'
    })
}

export function VerifyUserTravel(id) {
    const user = new User()
    return Http.request({
        url: `/users/${user.user.id}/travels/${id}`,
        method: 'GET'
    })
}
export function CreatePunch(id, category) {
    return Http.request({
        url: `/travels/${id}`,
        data: {
            category
        },
        method: 'POST'
    })
}
export function UserLottery(data) {
    return Http.request({
        url: '/users/lottery',
        data,
        method: 'POST'
    })
}
export function UserTodayLotteryCount(data) {
    return Http.request({
        url: '/users/today',
        data,
        method: 'POST'
    })
}
export function GetSubCategory(data) {
    return Http.request({
        url: '/travels/sub_categories',
        data,
        method: 'GET'
    })
}
